home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Communications Toolbox / CommToolbox 1.1 / Interfaces / PInterfaces / Connections.p < prev    next >
Encoding:
Text File  |  1994-11-21  |  8.1 KB  |  300 lines  |  [TEXT/MPS ]

  1. {************************************************************
  2.     Connections.p
  3.     Pascal Interface to the Macintosh Libraries
  4.  
  5.         Copyright Apple Computer, Inc. 1988-1991
  6.         All rights reserved
  7. ************************************************************}
  8.  
  9.  
  10. {$IFC UNDEFINED UsingIncludes}
  11. {$SETC UsingIncludes := 0}
  12. {$ENDC}
  13.  
  14. {$IFC NOT UsingIncludes}
  15.     UNIT Connections;
  16.     INTERFACE
  17. {$ENDC}
  18.  
  19. {$IFC UNDEFINED UsingConnections}
  20. {$SETC UsingConnections := 1}
  21.  
  22. {$I+}
  23. {$SETC ConnectionsIncludes := UsingIncludes}
  24. {$SETC UsingIncludes := 1}
  25. {$IFC UNDEFINED UsingDialogs}
  26. {$I $$Shell(PInterfaces)Dialogs.p}
  27. {$ENDC}
  28. {$IFC UNDEFINED UsingCTBUtilities}
  29. {$I $$Shell(PInterfaces)CTBUtilities.p}
  30. {$ENDC}
  31. {$SETC UsingIncludes := ConnectionsIncludes}
  32.  
  33. CONST
  34.  
  35. { current Connection Manager version }
  36. curCMVersion        =    2;
  37.  
  38. { current Connection Manager Environment Record version }
  39. curConnEnvRecVers    =    0;
  40.  
  41. { CMErr }
  42. cmGenericError        =    -1;
  43. cmNoErr                =    0;
  44. cmRejected             =    1;
  45. cmFailed            =    2;
  46. cmTimeOut            =    3;
  47. cmNotOpen            =    4;
  48. cmNotClosed            =    5;
  49. cmNoRequestPending    =    6;
  50. cmNotSupported        =    7;
  51. cmNoTools            =    8;
  52. cmUserCancel        =    9;
  53. cmUnknownError        =    11;
  54.  
  55. TYPE
  56. CMErr                =    OSErr;
  57.  
  58. CONST
  59.  
  60. {    Low word of CMRecFlags is same as CMChannel }
  61. cmData                =     $00000001;
  62. cmCntl                =     $00000002;
  63. cmAttn                =     $00000004;
  64.  
  65. cmDataNoTimeout        =     $00000010; 
  66. cmCntlNoTimeout        =     $00000020;
  67. cmAttnNoTimeout        =     $00000040;
  68.  
  69. cmDataClean            =     $00000100; 
  70. cmCntlClean            =     $00000200;
  71. cmAttnClean            =     $00000400;
  72.  
  73. {    only for CMRecFlags (not CMChannel) below this point }
  74. cmNoMenus            =     $00010000;
  75. cmQuiet                =     $00020000;
  76. cmConfigChanged        =    $00040000;
  77.  
  78. TYPE
  79. CMRecFlags         =     LONGINT;
  80.  
  81.  
  82. CMChannel         =     INTEGER;
  83.  
  84. CONST
  85.  
  86. { CMStatFlags }
  87. cmStatusOpening        =     $00000001;
  88. cmStatusOpen        =     $00000002;
  89. cmStatusClosing        =     $00000004;
  90. cmStatusDataAvail    =     $00000008;
  91. cmStatusCntlAvail    =     $00000010;
  92. cmStatusAttnAvail    =     $00000020;
  93.  
  94. cmStatusDRPend        =     $00000040;        {data read pending}
  95. cmStatusDWPend        =     $00000080;        {data write pending}
  96. cmStatusCRPend        =     $00000100;        {cntl read pending}
  97. cmStatusCWPend        =     $00000200;        {cntl write pending}
  98. cmStatusARPend        =     $00000400;        {attn read pending}
  99. cmStatusAWPend        =     $00000800;        {attn write pending}
  100.  
  101. cmStatusBreakPend     =    $00001000;
  102. cmStatusListenPend     =     $00002000;
  103. cmStatusIncomingCallPresent =    $00004000;
  104.  
  105. cmStatusReserved0    =    $00008000;
  106.  
  107. TYPE
  108. CMStatFlags     =     LONGINT;
  109.  
  110. CMBufFields = (cmDataIn,cmDataOut,cmCntlIn,cmCntlOut,cmAttnIn,cmAttnOut,
  111.     cmRsrvIn,cmRsrvOut);
  112.  
  113.  
  114. CMBuffers        =    ARRAY[CMBufFields] OF Ptr;
  115. CMBufferSizes    =    ARRAY[CMBufFields] OF LONGINT;
  116.  
  117. CONST
  118.  
  119. { CMSearchFlags }
  120. cmSearchSevenBit    =     $0001;
  121.  
  122. TYPE
  123. CMSearchFlags     =     INTEGER;
  124.  
  125.  
  126. CONST
  127.  
  128. { CMFlags }
  129. cmFlagsEOM            =     $0001;
  130.  
  131. TYPE
  132. CMFlags         =     INTEGER;
  133.  
  134.  
  135. ConnEnvironRecPtr =     ^ConnEnvironRec;
  136. ConnEnvironRec     =    RECORD
  137.     version:    INTEGER;
  138.     baudRate:    LONGINT;
  139.     dataBits:    INTEGER;
  140.     channels:    CMChannel;
  141.     swFlowControl:    BOOLEAN;
  142.     hwFlowControl:    BOOLEAN;
  143.     flags:    CMFlags;
  144.  END;
  145.  
  146. ConnPtr            =    ^ConnRecord;
  147. ConnHandle        =    ^ConnPtr;
  148. ConnRecord        =    RECORD
  149.     procID:    INTEGER;
  150.     flags:    CMRecFlags;
  151.     errCode:    CMErr;
  152.     refCon:    LONGINT;
  153.     userData:    LONGINT;
  154.     defProc:    ProcPtr;
  155.     config:    Ptr;
  156.     oldConfig:    Ptr;
  157.     asyncEOM:    LONGINT;
  158.     reserved1:    LONGINT;
  159.     reserved2:    LONGINT;
  160.     cmPrivate:    Ptr;
  161.     bufferArray:    CMBuffers;
  162.     bufSizes:    CMBufferSizes;
  163.     mluField:    LONGINT;
  164.     asyncCount:    CMBufferSizes;
  165.  END;
  166.  
  167.  
  168. { application routines type definitions }
  169. ConnectionSearchCallBackProcPtr = ProcPtr;
  170. ConnectionCompletionProcPtr = ProcPtr;
  171. ConnectionChooseIdleProcPtr = ProcPtr;
  172.  
  173. CONST
  174.  
  175. { CMIOPB constants and structure }
  176. cmIOPBQType = 10;
  177. cmIOPBversion = 0;
  178.  
  179. TYPE
  180. CMIOPBPtr        =    ^CMIOPB;
  181. CMIOPB            =    RECORD
  182.     qLink:    QElemPtr;
  183.     qType:    INTEGER;                { cmIOPBQType }
  184.     hConn:    ConnHandle;
  185.     theBuffer:    Ptr;
  186.     count:    LONGINT;
  187.     flags:    CMFlags;
  188.     userCompletion:    ConnectionCompletionProcPtr;
  189.     timeout:    LONGINT;
  190.     errCode:    CMErr;
  191.     channel:    CMChannel;
  192.     asyncEOM:    LONGINT;
  193.     reserved1:    LONGINT;
  194.     reserved2:    INTEGER;
  195.     version:    INTEGER;            { cmIOPBversion }
  196.     refCon:        LONGINT;            { for application }
  197.     toolData1:    LONGINT;            { for tool }
  198.     toolData2:    LONGINT;            { for tool }
  199.  END;
  200.     
  201.  
  202. FUNCTION     InitCM: CMErr;
  203. FUNCTION     CMGetVersion(hConn: ConnHandle): Handle;
  204. FUNCTION     CMGetCMVersion: INTEGER;
  205.  
  206. FUNCTION      CMNew(procID: INTEGER;flags: CMRecFlags;desiredSizes: CMBufferSizes;
  207.                     refCon: LONGINT;userData: LONGINT): ConnHandle;
  208.  
  209. PROCEDURE     CMDispose(hConn: ConnHandle);
  210.  
  211. FUNCTION     CMListen(hConn: ConnHandle;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  212.                     timeout: LONGINT): CMErr;
  213. FUNCTION     CMAccept(hConn: ConnHandle;accept: BOOLEAN): CMErr;
  214.  
  215. FUNCTION     CMOpen(hConn: ConnHandle;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  216.                     timeout: LONGINT): CMErr;
  217. FUNCTION     CMClose(hConn: ConnHandle;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  218.                     timeout: LONGINT;now: BOOLEAN): CMErr;
  219.  
  220. FUNCTION     CMAbort(hConn: ConnHandle): CMErr;
  221.  
  222. FUNCTION     CMStatus(hConn: ConnHandle;VAR sizes: CMBufferSizes;VAR flags: CMStatFlags): CMErr;
  223. PROCEDURE     CMIdle(hConn: ConnHandle);
  224.  
  225. PROCEDURE     CMReset(hConn: ConnHandle);
  226.  
  227. PROCEDURE     CMBreak(hConn: ConnHandle;duration: LONGINT;async: BOOLEAN;completor: ConnectionCompletionProcPtr);
  228.  
  229. FUNCTION     CMRead(hConn: ConnHandle;theBuffer: Ptr;VAR toRead: LONGINT;theChannel: CMChannel;
  230.                     async: BOOLEAN;completor: ConnectionCompletionProcPtr;timeout: LONGINT;
  231.                     VAR flags: CMFlags): CMErr;
  232. FUNCTION     CMWrite(hConn: ConnHandle;theBuffer: Ptr;VAR toWrite: LONGINT;
  233.                     theChannel: CMChannel;async: BOOLEAN;completor: ConnectionCompletionProcPtr;
  234.                     timeout: LONGINT;flags: CMFlags): CMErr;
  235.  
  236. FUNCTION     CMIOKill(hConn: ConnHandle;which: INTEGER): CMErr;
  237.  
  238. PROCEDURE     CMActivate(hConn: ConnHandle;activate: BOOLEAN);
  239. PROCEDURE     CMResume(hConn: ConnHandle;resume: BOOLEAN);
  240. FUNCTION     CMMenu(hConn: ConnHandle;menuID: INTEGER;item: INTEGER): BOOLEAN;
  241.  
  242. FUNCTION     CMValidate(hConn: ConnHandle): BOOLEAN;
  243. PROCEDURE     CMDefault(VAR theConfig: Ptr;procID: INTEGER;allocate: BOOLEAN);
  244.  
  245. FUNCTION     CMSetupPreflight(procID: INTEGER;VAR magicCookie: LONGINT): Handle;
  246. FUNCTION     CMSetupFilter(procID: INTEGER;theConfig: Ptr;count: INTEGER;theDialog: DialogPtr;
  247.                         VAR theEvent: EventRecord;VAR theItem: INTEGER;VAR magicCookie: LONGINT): BOOLEAN;
  248. PROCEDURE     CMSetupSetup(procID: INTEGER;theConfig: Ptr;count: INTEGER;theDialog: DialogPtr;
  249.                         VAR magicCookie: LONGINT);
  250. PROCEDURE     CMSetupItem(procID: INTEGER;theConfig: Ptr;count: INTEGER;theDialog: DialogPtr;
  251.                         VAR theItem: INTEGER;VAR magicCookie: LONGINT);
  252. PROCEDURE     CMSetupXCleanup(procID: INTEGER;theConfig: Ptr;count: INTEGER;
  253.                     theDialog: DialogPtr;OKed: BOOLEAN;VAR magicCookie: LONGINT);
  254. PROCEDURE    CMSetupPostflight(procID: INTEGER);
  255.  
  256. FUNCTION     CMGetConfig(hConn: ConnHandle): Ptr;
  257. FUNCTION     CMSetConfig(hConn: ConnHandle;thePtr: Ptr): INTEGER;
  258.  
  259. FUNCTION     CMIntlToEnglish(hConn: ConnHandle;inputPtr: Ptr;VAR outputPtr: Ptr;
  260.                     language: INTEGER): OSErr;
  261. FUNCTION     CMEnglishToIntl(hConn: ConnHandle;inputPtr: Ptr;VAR outputPtr: Ptr;
  262.                     language: INTEGER): OSErr;
  263.  
  264. FUNCTION     CMAddSearch(hConn: ConnHandle;theString: Str255;flags: CMSearchFlags;
  265.                     callBack: ConnectionSearchCallBackProcPtr): LONGINT;
  266. PROCEDURE     CMRemoveSearch(hConn: ConnHandle;refnum: LONGINT);
  267. PROCEDURE     CMClearSearch(hConn: ConnHandle);
  268.  
  269. FUNCTION     CMGetConnEnvirons(hConn: ConnHandle;VAR theEnvirons: ConnEnvironRec): CMErr;
  270.  
  271. FUNCTION     CMChoose(VAR hConn: ConnHandle;where: Point;idleProc: ConnectionChooseIdleProcPtr): INTEGER;
  272.  
  273. PROCEDURE     CMEvent(hConn: ConnHandle;theEvent: EventRecord);
  274.                     
  275. PROCEDURE     CMGetToolName(procID: INTEGER;VAR name: Str255);
  276. FUNCTION      CMGetProcID(name: Str255): INTEGER;
  277.  
  278. PROCEDURE     CMSetRefCon(hConn: ConnHandle;refCon: LONGINT);
  279. FUNCTION     CMGetRefCon(hConn: ConnHandle): LONGINT;
  280.  
  281. FUNCTION     CMGetUserData(hConn: ConnHandle): LONGINT;
  282. PROCEDURE     CMSetUserData(hConn: ConnHandle;userData: LONGINT);
  283.  
  284. PROCEDURE    CMGetErrorString(hConn: ConnHandle;id: INTEGER;VAR errMsg: Str255);
  285.  
  286. FUNCTION    CMNewIOPB(hConn: ConnHandle;VAR theIOPB: CMIOPBPtr): CMErr;
  287. FUNCTION    CMDisposeIOPB(hConn: ConnHandle;theIOPB: CMIOPBPtr): CMErr;
  288.  
  289. FUNCTION    CMPBRead(hConn: ConnHandle;theIOPB: CMIOPBPtr;async: BOOLEAN): CMErr;
  290. FUNCTION    CMPBWrite(hConn: ConnHandle;theIOPB: CMIOPBPtr;async: BOOLEAN): CMErr;
  291. FUNCTION    CMPBIOKill(hConn: ConnHandle;theIOPB: CMIOPBPtr): CMErr;
  292.  
  293.  
  294. {$ENDC} { UsingConnections }
  295.  
  296. {$IFC NOT UsingIncludes}
  297.     END.
  298. {$ENDC}
  299.  
  300.